<fieldset id="sf_fieldset_painting_<?php echo $number; ?>" class="">
<div class="form-row">
<dl>
<?php echo input_hidden_tag('post[images]['.$number.'][id]', $image->getId()) ?>


<?php if($image->getFileName()): ?>
  
  <dt><?php echo image_tag('/'.sfConfig::get('sf_upload_dir_name').'/thumb_'.$image->getFileName()); ?></dt>
  <dt style="float: left;">
    <?php echo checkbox_tag('post[images]['.$number.'][delete]', 1, false); ?>
    <label for="post[images][<?php echo $number; ?>][delete]"><?php echo __('Delete Image'); ?></label>
  </dt>
<?php endif; ?>

  <dt><?php echo __('Upload Image'); ?>:</dt>
  <dd><?php echo input_file_tag('file_'.$number) ?></dd>

  <dt><?php echo __('Date'); ?>:</dt>
  <dd><?php echo input_date_tag('post[images]['.$number.'][datetime]', $image->getDatetime(), array('rich' => true,)) ?></dd>
  
      <dt><?php echo __('Caption'); ?></dt>

  <?php foreach ($languages as $language): ?>

  <?php $image_i18n = ImageI18nPeer::retrieveByPk($image->getId(), $language->getCulture()); ?>
    
    <?php if($image_i18n instanceof ImageI18n): ?> 
      <dd>  
          <dl>
          <dt><?php echo $language->getName(); ?></dt>
          <dd>
            <?php echo input_hidden_tag('post[images]['.$number.'][i18n]['.$image_i18n->getCulture().'][id]', $image_i18n->getId()) ?>
            <?php echo input_tag('post[images]['.$number.'][i18n]['.$image_i18n->getCulture().'][caption]', $image_i18n->getCaption(), array ('size' => 80,)); ?>
          </dd>
          </dl>
      </dd>                            
        <?php else: ?>
      <dd>  
          <dl>
          <dt><?php echo $language->getName(); ?></dt>
          <dd>
            <?php echo input_hidden_tag('post[images]['.$number.'][i18n]['.$language->getCulture().'][id]', '') ?>
            <?php echo input_tag('post[images]['.$number.'][i18n]['.$language->getCulture().'][caption]', '', array ('size' => 80,)); ?>
          </dd>      
          </dl>
      </dd>
        <?php endif; ?>
  <?php endforeach; ?> 
</dl>

<?php if (isset($cancel)): ?>
<?php echo link_to_remote(__('Cancel'), array(
    'update' => 'image_form_'.$number,
    'url'    => '@default?module=image&action=cancel',
)) ?>
<?php endif; ?>

</div>
</fieldset>